home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-PR / Interfaces&Libraries / Interfaces / CIncludes / Disassembler.h next >
Encoding:
C/C++ Source or Header  |  1998-05-11  |  26.7 KB  |  471 lines  |  [TEXT/MPS ]

  1. /*---------------------------------------------------------------------------*
  2.  |                                                                           |
  3.  |                          <<< Disassembler.h >>>                           |
  4.  |                                                                           |
  5.  |                     Power[PC] Disassembler Interfaces                     |
  6.  |                                                                           |
  7.  |                               Ira L. Ruben                                |
  8.  |                                  5/9/93                                   |
  9.  |                                                                           |
  10.  |                  Copyright Apple Computer, Inc. 1993-1998                 |
  11.  |                           All rights reserved.                            |
  12.  |                                                                           |
  13.  *---------------------------------------------------------------------------*/
  14.  
  15. #ifndef __DISASSEMBLER__
  16. #define __DISASSEMBLER__
  17.  
  18. #if 0
  19. #define DisHdrVersion "3.1"                /* Current version nbr.rev of this header        */
  20. #endif
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26. /* All assembler options are of type DisassemblerOptions:                                                                */
  27.  
  28. typedef unsigned long DisassemblerOptions;
  29.  
  30. /* The following defines the "options" that can be passed to the disassembler.  All            */
  31. /* except ONE of the target architecture options have preset defaults.                                    */
  32.  
  33.                                                                                         /* Target architecture (one must be set):        */
  34. #define Disassemble_Power             0x00000001UL    /*    Power                                                                    */
  35. #define Disassemble_PowerPC32     0x00000002UL    /*       32-bitPowerPC                                            */
  36. #define Disassemble_PowerPC64  0x00000004UL    /*          64-bit PowerPC                                     */
  37. #define Disassemble_PowerPC601 0x00000008UL    /*             PowerPC 601                                    */
  38. #define Disassemble_Vec                 0x00000010UL    /*                Vector                                        */
  39.                                                                                         /* Error detection options:                         */
  40. #define Disassemble_RsvBitsErr 0x80000000UL    /*    invalid reserved bits is error                */
  41. #define Disassemble_FieldErr     0x40000000UL    /*    invalid field (regs, BO, etc.) error    */
  42.                                                                                         /* Formatting options (reverses presets):        */
  43. #define Disassemble_Extended     0x08000000UL    /*    extended mnemonics (ppc only)                    */
  44. #define Disassemble_BasicComm     0x04000000UL    /*    basic form in comment if extended            */
  45. #define Disassemble_DecSI             0x02000000UL    /*    SI fields formatted as decimal                */
  46. #define Disassemble_DecUI             0x01000000UL    /*    UI fields formatted as decimal                */
  47. #define Disassemble_DecField     0x00800000UL    /*         fields shown as decimal                                */
  48. #define Disassemble_DecOffset     0x00400000UL    /*    D of D(RA) shown in decimal                        */
  49. #define Disassemble_DecPCRel     0x00200000UL    /*    $+decimal offset instead of $+hex            */
  50. #define Disassemble_DollarHex     0x00100000UL    /*    $XXX... instead of 0xXXX...                        */
  51. #define Disassemble_Hex2sComp     0x00080000UL    /*         negative hex shown in 2s compliment        */
  52. #define Disassemble_MinHex         0x00040000UL    /*        min nbr of hex digits for values >= 0    */
  53. #define Disassemble_CRBits         0x00020000UL    /*    crN_LT, crN_GT, crN_EQ, crN_SO                */
  54. #define Disassemble_CRFltBits  0x00010000UL    /*        crN_FX, crN_FEX, crN_VX, crN_OX                */
  55. #define Disassemble_BranchBO     0x00008000UL    /*        branch BO meaning if not extended            */
  56. #define Disassemble_TrapTO          0x00004000UL    /*        trap TO meaning if not extended                */
  57. #define Disassemble_IBM                 0x00002000UL    /*    IBM assembler conventions                            */
  58.                                                                                                                                                                                 /*
  59. Except for the target architecture options, ONE of which must be set, here's an explanation
  60. of the other options and their preset default.
  61.      
  62. Disassemble_RsvBitsErr - Reserved bits in PowerPC instructions are considered a "warning"
  63.                                                  and causes the return status to be set to indicate whether
  64.                                                  reserved bits were incorrectly coded (1's that should be 0's and
  65.                                                  vice versa). The option indicates incorrectly coded reserved bits
  66.                                                  cause the instruction to be treated as "invalid".
  67.  
  68. Disassemble_FieldErr     - Attempted use of a field value not valid for a target is
  69.                                                  considered a "warning" and causes the return status to be set to
  70.                                                  indicate that fact.  The option indicates that use of a field
  71.                                                  whose value is not valid for the target is "invalid".  An example
  72.                                                  of an invalid field would be the use of a SPR not supported for
  73.                                                  the target architecture like the "HIDx" SPRs which are only valid
  74.                                                  for the 601.  Another example is non zero bits in the bc[l][a] BO
  75.                                                  field that are supposed to be zero.  Note this is NOT the same as
  76.                                                  Disassemble_RsvBitsErr.  But if a field has NO valid decoding
  77.                                                  value for ANY target, that is always considered as an invalid
  78.                                                  instruction.
  79.  
  80. Disassemble_Extended     - Extended mnemonics are NOT generated.  The option allows the
  81.                                                  extended mnemonic generation (recommended).  Only PowerPC32,
  82.                                                  PowerPC64, and PowerPC32 and PowerPC64 instructions used on the
  83.                                                  601 are supported.
  84.  
  85. Disassemble_BasicComm     - The basic instruction form is NOT placed in the comment field.
  86.                                                  The option causes the basic form of the instruction to be placed
  87.                                                  in the comment if an extended mnemonic is generated for it.  This
  88.                                                  option is not recommended since it is mainly for debugging and it
  89.                                                  tends to "clutter" up the comment field making it harder to see
  90.                                                  branch addresses.
  91.  
  92. Disassemble_DecSI             - SIs (signed immediate integers) are formatted as hex.  The option
  93.                                                  causes SI operands to be generated as decimal integers.
  94.  
  95. Disassemble_DecUI             - UIs (unsigned immediate integers) are formatted as hex.  The
  96.                                                  option causes UI operands to be generated as decimal integers.
  97.  
  98. Disassemble_DecField     - All fields (e.g., shift/rotate constants) are shown as hex.  The
  99.                                                  option causes the offsets to be generated as decimal integers.
  100.  
  101. Disassemble_DecOffset  - The "D" offsets in operands of the form D(RA) are shown in hex.
  102.                                                  The option causes these to be generated as decimal.
  103.  
  104. Disassemble_DecPCRel     - PC-relative branch addresses are formatted as "$+n" or "$-n", with
  105.                                                  the offset ("n") generated in hex.  The option causes the offset
  106.                                                  to be generated as decimal.
  107.  
  108. Disassemble_DollarHex     - Hex values are prefixed with "0x".  The option causes hex values
  109.                                                  to be formatted as "$XXX...".
  110.  
  111. Disassemble_Hex2sComp     - Signed negative values that are shown in hex are negated and
  112.                                                  prefixed with a "-" (e.g. "-0x0001").  The option causes these
  113.                                                  values to be shown in their two's complement form (e.g.,
  114.                                                  "0xFFFFFFFF").
  115.  
  116. Disassemble_MinHex         - Positive hex values or negated negative values are always shown
  117.                                                  with the number of digits attempting to indicate the size of the
  118.                                                  instruction field which produced the value or the implied value
  119.                                                  size.  Thus 32-bit target addresses are shown as 8 hex digits,
  120.                                                  16-bit field values are shown with 4 hex digits, byte field values
  121.                                                  as 2 hex digits.  5 or six-bit values are also shown as 2 hex
  122.                                                  digits since the minimum is always at least 2. The option forces
  123.                                                  the generation to always use 2 as the minimum even if the value
  124.                                                  came from a bigger field (e.g., "0x1234" address, "0x01" or
  125.                                                  "-0x01" from a 16-bit field).
  126.  
  127. Disassemble_CRBits          - Condition register field bits are referenced as bit numbers 0:31
  128.                                                  in the basic instruction operand forms.  The option causes these
  129.                                                  bits to be referenced using the format “crN_X”, where N is a 4-bit
  130.                                                  CR field (0:7) and X is the bit “name” in the field (“LT”, “GT”,
  131.                                                  “EQ”, “SO” for bits 0, 1, 2, and 3 respectively).  Note, this
  132.                                                  notation is always used with extended mnemonics.
  133.  
  134. Disassemble_CRFltBits  - Condition register field bits are referenced as bit numbers 0:31
  135.                                                  in the basic instruction operand forms.  The option is identical
  136.                                                  to Disassemble_CRBits to generate the references as “crN_X”,
  137.                                                  except that the bits (X) are referenced as “FX”, “FEX”, “VX” and
  138.                                                  “OX” for the four bits 0,1, 2, and 3 respectively.  This option
  139.                                                  can be used if the context of floating-point operations, but it's
  140.                                                  up to the caller to determine that context.
  141.  
  142. Disassemble_BranchBO     - Branch test BO encodings are referenced as values 0:31 in the 
  143.                                                  basic instruction operand forms.  The option causes the BO value
  144.                                                  to be referenced as more meaningful names (e.g., "dCTR_NZERO_NOT",
  145.                                                  "ALWAYS", etc.).
  146.                                                  
  147. Disassemble_TrapTO         - Trap TO operand encodings are referenced as values 0:31 in the 
  148.                                                   basic instruction operand forms.  The option causes the TO value
  149.                                                  to be an expression of the form "x|y|...", where the "x", "y",
  150.                                                  and so are the meaning of each of the five TO bits; "LT", "GT",
  151.                                                  "EQ", "LOW", "HI" for bits 0, 1, 2, 3, and 4 respectively.
  152.  
  153. Disassemble_IBM                 - Apple assembler conventions are used for comments and invalid
  154.                                                  instructions.  The option causes IBM assembler conventions to be
  155.                                                  used for these.  A “#” is used instead of a “;” as the comment
  156.                                                  character, and “.long” is used instead of “dc.l” for the invalid
  157.                                                  instruction directive mnemonic.
  158.  
  159.                                   [Are we having fun yet?]                                                                */
  160.  
  161. /* The following defines a set of the above options which seem to give "acceptable"         */
  162. /* results:                                                                                                                                                            */
  163.  
  164. #define DisStdOptions (Disassemble_Extended  |            /* permit extended mnemonics                */\
  165.                        Disassemble_DecSI     |            /* decimal SIs but hex UIs                    */\
  166.                        Disassemble_DecField  |            /* decimal field numbers                        */\
  167.                        Disassemble_BranchBO  |            /* meaning of branch BO                            */\
  168.                                              Disassemble_TrapTO         |            /* meaning of trap TO                                */\
  169.                                              Disassemble_CRBits)                    /* CR bits references as crN_X            */
  170.                                              
  171.  
  172. /* The optional lookup function (NULL could be passed) is used to allow the caller to        */
  173. /* substitute name strings for various objects that can occur in an operand.  It should    */
  174. /* return a pointer to a non-null string if substitution is desired.  If NULL or a null */
  175. /* string is returned, the disassembler uses its own default names.  The following            */
  176. /* defines the possible substitutable objects:                                                                                    */
  177.  
  178. typedef enum {                                                            /* Types of substitutable objects:                    */
  179.     Disassembler_Lookup_GPRegister,                        /*            general purpose register                        */
  180.     Disassembler_Lookup_FPRegister,                        /*            floating point register                            */
  181.     Disassembler_Lookup_UImmediate,                        /*            unsigned immediate value                        */
  182.     Disassembler_Lookup_SImmediate,                        /*            signed (32-bit) immediate value            */
  183.     Disassembler_Lookup_AbsAddress,                        /*            absolute addresse                                        */
  184.     Disassembler_Lookup_RelAddress,                        /*            relocatable addresse                                */
  185.     Disassembler_Lookup_RegOffset,                        /*            offset from a base register                    */
  186.     Disassembler_Lookup_SPRegister,                        /*            special purpose register                        */
  187.     Disassembler_Lookup_VecRegister                        /*            vector register                                            */
  188. } DisassemblerLookupType;
  189.  
  190. /* Here's a definition of an object (value) which is a function of each                                 */
  191. /* DisassemblerLookupType:                                                                                                                            */
  192.  
  193. union DisLookupValue {                                            /* A "meaningful" name for each value type:    */
  194.     unsigned long gpr;                                                /*        Disassembler_Lookup_GPRegister                */
  195.     unsigned long fpr;                                                /*        Disassembler_Lookup_FPRegister                */
  196.     unsigned long vr;                                                    /*        Disassembler_Lookup_VecRegister                */
  197.     unsigned long ui;                                                    /*        Disassembler_Lookup_UImmediate                */
  198.     long                    si;                                                    /*        Disassembler_Lookup_SImmediate                */
  199.     long                    absAddress;                                    /*        Disassembler_Lookup_AbsAddress                */
  200.     long                    relAddress;                                    /*        Disassembler_Lookup_RelAddress                */
  201.     unsigned long    spr;                                                /*         Disassembler_Lookup_SPRegister                */
  202.     struct {                                                                    /*        Disassembler_Lookup_RegOffset                    */
  203.         short                  offset;
  204.         unsigned short baseReg;
  205.     } regOffset;
  206. };
  207. typedef union DisLookupValue DisLookupValue, *DisLookupValuePtr;
  208.  
  209. /* The "lookup" substitution routine for the above objects is defined as below.                    */
  210.  
  211. /*                               WARNING and CAUTION                                                                        */
  212.  
  213. /* This routine MUST be defined as a C function, not a C++ member function.  The reason    */
  214. /* for this is that the disassembler is built using a C compiler.  Some compilers (for     */
  215. /* example, SC and SCpp) have different calling conventions for C and C++. Further, for */
  216. /* C++ member functions there is the additional "this" pointer which obviously is not     */
  217. /* passed to the callback routine.                                                                                                            */
  218.  
  219. typedef char *(*DisassemblerLookups)(void                                                 *refCon,
  220.                                                                          const unsigned long                      *cia, 
  221.                                                                          const DisassemblerLookupType lookupType,
  222.                                                                          const DisLookupValue                  thingToReplace);
  223.  
  224. /* where, refCon                  = A "reference constant" that can be used as a communication link
  225.                                                      between the lookup routine and the caller of the disassembler.
  226.                                                      It is the same refCon passed to the disassembler.
  227.  
  228.                     cia                       = The instruction address passed to the disassembler.
  229.  
  230.                     lookupType and
  231.                     thingToReplace = The kind of object and the associated value of that object to be
  232.                                                      replaced.  As defined by DisLookupValue, the thingToReplace has
  233.                                                      the following value for each lookupType.
  234.  
  235.                                                      lookupType                                                value            
  236.                                                      ============================================= 
  237.                                                      Disassembler_Lookup_GPRegister        0:31                
  238.                                                      Disassembler_Lookup_FPRegister        0:31                
  239.                                                      Disassembler_Lookup_UImmediate        integer    
  240.                                                      Disassembler_Lookup_SImmediate        integer        
  241.                                    Disassembler_Lookup_AbsAddress        address [1]
  242.                                                      Disassembler_Lookup_RelAddress        address [2]
  243.                                                      Disassembler_Lookup_RegOffset        D + Ra  [3]
  244.                                                      Disassembler_Lookup_SPRegister        spr            [4]
  245.                                                      Disassembler_Lookup_VecRegister  0:31    [5]
  246.                                                      =============================================
  247.  
  248.                                                       Notes: 
  249.                                                      
  250.                                                      [1] This is an absolute target branch address, i.e., the "a" bit
  251.                                                               in the branch instruction IS set.  The passed absAddress
  252.                                                              is the address contained in the instruction.
  253.                                                              
  254.                                                      [2] This is a relocatable target branch address, i.e., the "a"
  255.                                                               bit in the branch instruction was NOT set.  The relAddress
  256.                                                              is relative to the current instruction address adjusted
  257.                                                              by the dstAdjust.  Thus,
  258.                                                              
  259.                                                              relAddress = destinationAddress + dstAdjust + cia
  260.                                                              
  261.                                                              where cia is the current instruction address, i.e, the value
  262.                                                              of the instruction address passed to the disassembler.
  263.                                                                             
  264.                                                      [3] Both the offset (D) and base register (Ra) are passed.  The
  265.                                                               DisLookupValue.regOffset value defines how they are packed
  266.                                                              in the thingToReplace.  The offset should be assigned to a
  267.                                                              long to get its true 32-bit value.  It is valid to pass it
  268.                                                              as a signed short since the instruction field from which it
  269.                                                              came is never more than 16 bits wide.
  270.                                                      
  271.                                                      [4] The lookup for SPRs is slightly different in that it is only
  272.                                                               done as an ESCAPE mechanism, i.e., only when the SPR number is
  273.                                                              NOT one of the predefined Power, 601, PowerPC32, or
  274.                                                              PowerPC64 SPR names.  This is done because a different
  275.                                                              PowerPC architectures can have additional SPRs specific to
  276.                                                              those architectures!  The lookup routine is called only if
  277.                                                              the SPR is NOT one of the following predefined numbers:
  278.                                                                     
  279.                                                                 0 MQ      272 SPRG0   528 IBAT0U   536 DBAT0U   1008 HID0
  280.                                                                 1 XER     273 SPRG1   529 IBAT0L   537 DBAT0L   1009 HID1
  281.                                                                 4 RTCU    274 SPRG2   530 IBAT1U   538 DBAT1U   1010 IABR
  282.                                                                 5 RTCL    275 SPRG3   531 IBAT1L   539 DBAT1L   1013 DABR
  283.                                                                 6 DEC     280 ASR     532 IBAT2U   540 DBAT2U   1023 PIR
  284.                                                                 8 LR      282 EAR     533 IBAT2L   541 DBAT2L
  285.                                                                 9 CTR     284 TB      534 IBAT3U   542 DBAT3U
  286.                                                              18 DSIAR   285 TBU     535 IBAT3L   543 DBAT3L
  287.                                                              19 DAR     287 PVR
  288.                                                              22 DEC
  289.                                                              25 SDR1
  290.                                                              26 SRR0
  291.                                                              27 SRR1
  292.                                                             
  293.                                                              Not all of these SPRs are valid for all targets.  The
  294.                                                              disassembler will check to see if these SPRs are valid for
  295.                                                              the specified target architecture.  If they are not, the SPR
  296.                                                              number is treated as an invalid field and processed
  297.                                                              according to the Disassemble_FieldErr option, i.e., it’s
  298.                                                              accepted but returns a status warning, or the instruction is
  299.                                                              treated as invalid (“DC.L 0xXXXXXXXX”).
  300.  
  301.                                                              SPR numbers which are not on the list, and also do not have
  302.                                                              a lookup substitution name, are always accepted.  But since
  303.                                                              there is no way for the disassembler to validate these
  304.                                                              against the target, the Disassembler_InvSprMaybe return
  305.                                                              status flag will be set.
  306.                                                      
  307.                                                      [5] The vector registers are only used if the Disassemble_Vec
  308.                                                          was passed in the options.                                                                */
  309.                                                              
  310.  
  311. /* Finally, at long last, here's the definition of the disassembler...                                    */
  312.  
  313. typedef unsigned short DisassemblerStatus;        /* disassembler return status (see below)    */
  314.  
  315. DisassemblerStatus ppcDisassembler(unsigned long           *instruction, 
  316.                                                                      long                            dstAdjust,
  317.                                                                      DisassemblerOptions options,
  318.                                                                      char                                 *mnemonic,
  319.                                                                      char                                 *operand,
  320.                                                                      char                                 *comment,
  321.                                                                      void                                 *refCon,
  322.                                                                      DisassemblerLookups lookupRoutine);
  323.     /*
  324.     Takes the four bytes pointed to by instruction and disassembles it, placing the mnemonic,
  325.     operand, and comment in the strings provided.  The caller is then free to format or use
  326.     the output strings any way appropriate to the application.  Any of these strings may be a
  327.     null pointer, in which case that portion of the disassembled instruction is not returned.
  328.     If they are not null, it is ASSUMED that the associated buffers are large enough to hold
  329.     the disassembled output.
  330.     
  331.     Comments are formatted starting with a "; " (or "#" if the appropriate "IBM" option is
  332.     set).  Invalid instructions generate a "dc.l" (".long" for IBM), an operand of the form
  333.     0xXXXXXXXX showing the actual instruction, and a comment with a message indicating what
  334.     is wrong with the instruction.
  335.     
  336.     For PC-relative branches, the comment generated is the destination address, the only
  337.     address that the disassembler "knows" about is the address of the code pointed to by the
  338.     instruction.  Generally, that may be a buffer that has no relation to "reality", i.e.,
  339.     the actual code loaded into the buffer.  Therefore, to allow the address comment to be
  340.     mapped back to some actual address, the caller may specify an adjustment factor,
  341.     specified by dstAdjust that is ADDED to the value that normally would be placed in the
  342.     comment.
  343.  
  344.     Many operands usually consist of registers, absolute and relocatable addresses, and
  345.     signed and unsigned values.  In places where these occur, the disassembler can call a
  346.     user specified routine to do the substitution using the lookupRoutine parameter if it
  347.     is not NULL.  A "refcon" is passed to the disassembler that is, in turn, passed on to
  348.     the lookup routine to allow a communication path between the disassembler caller and its
  349.     lookup routine.  The refcon can be anything.  The disassembler does not look at it.
  350.     
  351.     The caller also can control some aspects of the formatting with the DisassemblerOptions
  352.     as described above.  The options also specify the target architecture; Power, PowerPC32,
  353.     PowerPC64, or PowerPC601.
  354.     
  355.     The disassembler returns as its function result the DisassemblerStatus.  This may be
  356.     tested for 0 ("false" or DisInvalid defined below) to find out if an invalid instruction
  357.     was detected.  For valid instructions, the DisassemblerStatus is non zero and indicates
  358.     various attributes about the instruction as follows:                                                                    */
  359.     
  360.     /* Return status flags:                                                                                                                                */
  361.     
  362.     #define Disassembler_OK                     0x0001U    /* instruction successfully decoded                    */
  363.     #define Disassembler_InvRsvBits     0x0002U    /* invalidly coded reserved bits                        */
  364.     #define Disassembler_InvField         0x0004U    /* invalidly coded field(s)                                    */
  365.     #define Disassembler_InvSprMaybe    0x0008U    /* possibly invalid SPR                                            */
  366.     #define Disassembler_601Power          0x0010U    /* power instruction used with 601                    */
  367.     #define Disassembler_Privileged   0x0020U    /* privileged instruction                                        */
  368.     #define Disassembler_Optional         0x0040U    /* optional instruction                                            */
  369.     #define Disassembler_Branch                0x0080U    /* branch instruction                                                */
  370.     #define Disassembler_601SPR                0x0100U    /* SPR valid only for 601 has been used            */
  371.     #define Disassembler_Vec                    0x0200U    /* vector instruction                                                */
  372.     #define Disassembler_HasExtended  0x4000U    /* possible extended mnemonic                                */
  373.     #define Disassembler_ExtendedUsed 0x8000U    /* the extended mnemonic was generated            */
  374.  
  375.     #define DisInvalid ((DisassemblerStatus)0x0000U)    /*       invalid instruction                */
  376.  
  377.     /*
  378.     Unless DisInvalid (0) is returned as the function result, Disassembler_OK will always be
  379.     set.  The other flags have the following meaning:
  380.     
  381.     Disassembler_InvRsvBits        - The instruction had some or all of its reserved bits
  382.                                                             incorrectly coded, and the Disassemble_RsvBitsErr option was
  383.                                                             NOT set.  This is something like a "warning". With the option
  384.                                                             set, this condition is considered as an "error" and the
  385.                                                             "invalid instruction" is generated ("dc.l 0xXXXXXXXX").
  386.     
  387.     Disassembler_InvField            -    The instruction had fields incorrectly coded for the
  388.                                                             target, but is is still valid for some target (e.g., not
  389.                                                             valid for the 601 but valid for the PowerPC64), and the
  390.                                                             Disassemble_FieldErr option was NOT set.
  391.     
  392.     Disassembler_InvSprMaybe    - A mfspr or mtspr instruction references a POSSIBLY invalid
  393.                                                             SPR.  This occurs when an SPR value is not for one of the
  394.                                                             predefined SPR names (see list above) and there is no lookup
  395.                                                             routine, or it does not supply a substitution name.  In that
  396.                                                             case the SPR register number is generated.  Since there is
  397.                                                             no way of the disassembler knowing whether the register is
  398.                                                             valid for the architecture of interest, this flag is set 
  399.                                                             instead of Disassembler_InvField to indicate the possibility
  400.                                                             that the SPR may be invalid.
  401.     
  402.     Disassembler_601Power            - The options specified that the target architecture is the
  403.                                                             601 (Disassemble_PowerPC601), and a Power instruction was
  404.                                                             disassembled.  The 601 is basically an ORing of the Power
  405.                                                             and PowerPC32 architectures.  But this flag could be useful
  406.                                                             for "weeding" Power instructions out in preparation for use
  407.                                                             on a "pure" PowerPC32 or PowerPC64 architecture.
  408.     
  409.     Disassembler_601SPR                - The options specified that the target architecture is the
  410.                                                             601 (Disassemble_PowerPC601), and a mfspr or mtspr
  411.                                                             instruction references a SPR valid ONLY for the 601.
  412.     
  413.     Disassembler_Vec                    -    The instruction is a vector instruction.
  414.     
  415.     Disassembler_Privileged        - The instruction is privileged.
  416.                                                             
  417.     Disassembler_Optional            - The instruction is optional.
  418.     
  419.     Disassembler_Branch                -    Branch instruction; bc[l][a], b[l][a], bclr[l], bcctr[l] and
  420.                                                             Power bcr[l], bcc[l].  If any of these instructions are
  421.                                                             processed the flag is set.  Branches are signaled because
  422.                                                             the caller might want to do some additional processing on
  423.                                                             these.  For example, a debugger might want to dynamically
  424.                                                             show which way the branch is taken, or static analysis might
  425.                                                             want to know possible exit points from a function or show
  426.                                                             the branch in some graphical way.  Although the caller could
  427.                                                             determine if the instruction is a branch, the disassembler
  428.                                                             always has to classify the instructions passed to it, so
  429.                                                             there is no sense having both do it if the information is
  430.                                                             already available.  Note, the caller might still, however,
  431.                                                             need to extract the BO and BI fields to determine the
  432.                                                             condition of the branch, but at least it only needs to be
  433.                                                             done when the flag is set.
  434.     
  435.     Disassembler_HasExtended     - The instruction POSSIBLY has an extended mnemonic, whether
  436.                                                             used or not used (as a function of the Disassemble_Extended
  437.                                                             option). Note, "possibly has an extended mnemonic"; the
  438.                                                             instruction could have extendeds, but not for all
  439.                                                             values of its operands.
  440.                                                             
  441.     Disassembler_ExtendedUsed - The instruction has an extended mnemonic, and it was used
  442.                                                             because the option (Disassemble_Extended) permits it.  The
  443.                                                             operand is formatted appropriate to the extended mnemonic.
  444.                                                             Whether the original basic form is placed in the comment or
  445.                                                             not is controlled by the Disassemble_BasicComm option.
  446.     */
  447.     
  448.     
  449. /* NOTES: 1. The disassembler library uses the convention that, with the exception of     */
  450. /*                     the called routine name itself, i.e., "ppcDisassembler", all externally         */
  451. /*                     visible names (linker symbols and macro names) begin with the letters "dis"*/
  452. /*                      (in any case).  The user should keep this in mind to avoid possible name     */
  453. /*                      conflicts.                                                                                                                                    */
  454.  
  455. /*                2. Except for statically declared (read only) tables, the disassembler uses no*/
  456. /*                     other global data.                                                                                                                    */
  457.  
  458. /*                3. The disassembler is fully self contained in that it has no explicit                 */
  459. /*                     references to any runtime library routines (e.g., strcpy).  There may,         */
  460. /*                     however, be implicit references generated by the (C) compiler.                            */
  461.  
  462. /*                4. The disassembler is written in standard ANSI C making it possible to easily*/
  463. /*                     port to other platforms.                                                                                                        */
  464.  
  465.  
  466. #ifdef __cplusplus
  467. }
  468. #endif
  469.  
  470. #endif
  471.